<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE6">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<link rel="shortcut icon" href="<%=basePath%>favicon.ico">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>css/all_b.css?20161126">
		<script type="text/javascript" src="<%=basePath%>js/jquery.min.js?20161104"></script>
		<script type="text/javascript" src="<%=basePath%>js/layer/layer.js"></script>
		<title>后台配置赔率</title>
	</head>
	<body style="" id="bodyModule">
		<jsp:include page="../commons/manage_head.jsp" flush="true"></jsp:include>
		<div style="height:580px;" id="layout" class="container">
			<div style="display: block;" id="rightLoader" dom="right"
				class="main-content bet-content">
				<div id="memberList" class="page">
					<div class="title">
						<span id="account_name">后台配置赔率</span>
						<a href="javascript:history.go(-1)" id="reback" level="1"
							class="mag-btn1">返回</a>
					</div>
					<ul pager="true" class="pager">
						<li class="first" id="first"></li>
						<li class="previous" id="previous"></li>
						<li class="other">
							第
							<input id="current_page" value="${pageBean.pageNum}" type="text">
							页
						</li>
						<li class="other t-pager">
							共
							<span id="total_page">${pageBean.pages}</span>页
						</li>
						<li class="next" id="next"></li>
						<li class="last" id="last"></li>
					</ul>
					<table class="clear-table mag-list" id="memeber_tb">
						<thead>
							<tr>
								<th>
									编号
								</th>
								<th>
									名称
								</th>
								<th>
									赔率
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody id="accounts_tb">
							<c:forEach items="${pageBean.list}" var="dict" varStatus="st">
								<tr>
									<td class="t-l">
										<a href="javascript:void(0)" lower="6" class="bold">${dict.dictId}</a>
									</td>
									<td>
										${dict.dictName}
									</td>
									<td>
										<input maxlength="10" name="dictRate" type="text" value="${dict.dictRate }">
									</td>
									<td class="op">
										<a href="javascript:void(0)" edit="6" target="update" dictid="${dict.dictId}">修改</a>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</body>
	<script>
	$(function(){
		var currPage = $("#current_page").val();
		var pages = ${pageBean.pages};
	    $('.next').click(function(){
	    	currPage = $("#current_page").val();
	    	if(currPage < pages){
	    		currPage = parseInt(currPage) + 1;
	    	}
	    	window.location.href = "<%=basePath%>dict/dict_list?page="+currPage;
	    });
	    
	    $('.previous').click(function(){
	    	currPage = $("#current_page").val();
	    	if(currPage > 1){
	    		currPage = parseInt(currPage) - 1;
	    	}
	    	window.location.href = "<%=basePath%>dict/dict_list?page="+currPage;
	    });
	    $(document).bind("contextmenu",function(e){   
		       return false;   
		});
	    $('.first').click(function(){
	    	currPage = 1;
	    	window.location.href = "<%=basePath%>dict/dict_list?page="+currPage;
	    });
	    
	    $('.last').click(function(){
	    	currPage = pages;
	    	window.location.href = "<%=basePath%>dict/dict_list?page="+currPage;
	    });
	    
	    $("a[target=update]").click(function(){
	    	var dictRate = $(this).parents("tr").find("input[name=dictRate]").val();
			var dictId = $(this).attr("dictId");
			if($.trim(dictRate) == ''){
				layer.msg("赔率不能为空");
			}
			$.ajax({
				url:"<%=basePath%>dict/update_dict_rate",
		    	type:"POST",
		    	data:{"dictId":dictId,"dictRate":dictRate},
		    	success:function(data){
		    		layer.msg(data.msg);
		    		window.location.reload();
		    	}
			});
			
	    });
	});
	</script>
</html>